import BIM from "../BIM";
import { MODE, VIEW } from "../const/const";
import ModeDefault from "../mode/ModeDefault";
import ModeDrawBeam from "../mode/ModeDrawBeam";
import ModeDrawWall from "../mode/ModeDrawWall";

export default class ModeManager {

    constructor() {
        this.curMode = new ModeDefault();

    }

    enter(mode) {
        // 处理下视角切换

        // 退出上个一个模式
        this.curMode.exit();
        // 
        // this.changeView(mode);
        // 进入指定模式
        this.curMode = this.enterMode(mode);
       
    }

    enterMode(mode) {
        console.log("enter mode:", mode);

        switch (mode) {
            case MODE.drawwall:
                return new ModeDrawWall();
            case MODE.drawbeam:
                return new ModeDrawBeam();
            default:

                return new ModeDefault();
        }
    }

    changeView(mode) {
        let view = mode === MODE.default ? VIEW.normalview : VIEW.drawview;
        BIM.MGR.sceneMgr.changeView(view);
    }


}